Repository navigation
Conversation
_stop_duckdb_ui_server called stop_ui_server() whenever the server start hook ran, but the function only exists once the ui extension is loaded. When it is not (e.g. the lifecycle test monkeypatches the start hook), DuckDB auto-installs the extension from the network during shutdown -- seconds on a slow connection, and pointless: there is no server to stop if the extension was never loaded. That network fetch inside a teardown another thread waits on with a fixed timeout is almost certainly the flaky test_catalog_ui timing failure reported on Hebbian-Robotics#326, Hebbian-Robotics#327 and Hebbian-Robotics#328. Guard the call with a duckdb_extensions() loaded check: production always LOADs ui before the server starts, so the stop call is preserved, and a connection that never loaded the extension now closes directly. Pin both shutdown branches with tests that record the statements executed on the connection (Hebbian-Robotics#336 DoD): the stubbed-starter path must issue no stop_ui_server() call, and a session whose ui extension is loaded must still stop its server. Closes Hebbian-Robotics#336
|
👋 Hi @rakesh0x — thanks for the contribution! To keep starter issues available You already have #334 open, so this one is being closed automatically. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #336
What and why
serve_catalog_uisetsserver_started = Trueas soon as_start_duckdb_ui_serverreturns, and shutdown callsstop_ui_server()on that flag alone.stop_ui_server()is a function theuiextension provides — calling it on a connection that never loaded the extension makes DuckDB auto-install the extension from the network at shutdown, to run what is a no-op: there is no server to stop if the extension was never loaded.I measured the cost with a cold extension directory (
extension_directorypointed at an empty dir):That network fetch inside a teardown that another thread waits on with a fixed timeout is almost certainly the flaky
test_catalog_uitiming failure three contributors reported on 2026-08-31 (#326, #327, #328) —tests/test_catalog_ui.pystubs_start_duckdb_ui_server, so the extension never loads, butserver_startedis stillTrueand teardown callsstop_ui_server()anyway.The fix
Guard the call on the extension actually being loaded on that connection:
and gate
stop_ui_server()onserver_started and _ui_extension_is_loaded(...). Production is unchanged: the real starter runsINSTALL ui/LOAD uibefore the server starts, so the loaded check passes and the stop call still happens. A connection that never loaded the extension now closes directly.DoD coverage
stop_ui_server()whenuiis not loaded —test_catalog_ui_shutdown_does_not_stop_a_server_the_ui_extension_never_loadedpins it by recording every statement executed on the connection (per the issue: recording statements is enough; DuckDB's install behavior is not the point).uiextension is loaded still stops its server —test_catalog_ui_shutdown_stops_the_server_when_the_ui_extension_is_loadedpins the stop call on the loaded branch, and that the connection still closes.Validation
Found by me while working on #291; the reachability trace (stubbed starter →
server_started = True→ network fetch in teardown) is from the issue.